home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / obsolete / ln03.pro < prev    next >
Encoding:
Text File  |  1997-07-08  |  4.1 KB  |  136 lines

  1. ; $Id: ln03.pro,v 1.2 1997/01/15 04:02:19 ali Exp $
  2. ;
  3. ; Copyright (c) 1988-1997, Research Systems, Inc.  All rights reserved.
  4. ;       Unauthorized reproduction prohibited.
  5.  
  6. Pro LN03, Filename, To_terminal
  7. ;+
  8. ; NAME:
  9. ;    LN03
  10. ;
  11. ; PURPOSE:
  12. ;    Produce plot files suitable for printing by an LN03+ laser printer.
  13. ;
  14. ; CATEGORY:
  15. ;    Graphics.
  16. ;
  17. ; CALLING SEQUENCE:
  18. ;    LN03, Filename        ;To start outputting plot codes to a file and
  19. ;                ;the terminal.
  20. ;
  21. ;    LN03, Filename, 0    ;Same as above, but don't send to terminal.
  22. ;
  23. ;    LN03            ;To close the file.
  24. ;
  25. ; INPUTS:
  26. ;    Filename:    The name of the file to contain the plots.  The default 
  27. ;        extension is .LIS.
  28. ;
  29. ; To_terminal:    An optional parameter, which if present and 0, inhibits
  30. ;        sending the plots to the terminal.  Note: The terminal must
  31. ;        be a Tektronix compatible terminal.
  32. ;
  33. ; OUTPUTS:
  34. ;    No explicit outputs.
  35. ;
  36. ; COMMON BLOCKS:
  37. ;  LN03_COMMON:    This common block ontains the unit number and name of the 
  38. ;        graphics device to restore to when finished.
  39. ;
  40. ; SIDE EFFECTS:
  41. ;    A file is opened and closed.
  42. ;
  43. ; RESTRICTIONS:
  44. ;    Be sure to call LN03 to close the file after all the plots have
  45. ;    been produced.  If you don't, the file will not contain the escape
  46. ;    sequence to take the printer out of the Tektronix mode when done.
  47. ;
  48. ;    You can repeat this process as many times as you wish,
  49. ;    producing more than one file.
  50. ;
  51. ;    The plot files produced by IDL must be printed using a
  52. ;    special form:
  53. ;
  54. ;    For VMS, include the following command in your 
  55. ;    SYS$MANAGER:SYSTARTUP.COM file:
  56. ;
  57. ;        $ DEFINE /FORM PLOT 3 /NOWRAP /NOTRUNC /STOCK=DEFAULT
  58. ;
  59. ;    This command makes the form and assigns it to form number 3.
  60. ;    Of course, you can also define a symbol to accomplish
  61. ;    the same thing in your LOGIN.COM file:
  62. ;
  63. ;        $ PLOT :== PRINT /FORM=PLOT /PASSALL
  64. ;
  65. ;    Then, to print a plot file, enter:
  66. ;
  67. ;        $ PLOT EXAMPLE
  68. ;
  69. ;    Real VMS wizards may want to define a device-control library for the 
  70. ;    PLOT form to insert the escape sequences at the beginning to put 
  71. ;    the LN03+ into the Tektronix mode, and to revert to the normal mode.
  72. ;    In this case, you will have to remove the print statements in the LN03 
  73. ;    procedure that put these escape sequences in the output file.
  74. ;
  75. ;    For ULTRIX, we can make no specific recommendations, as the
  76. ;    printcap files vary greatly.  We suggest that you copy
  77. ;    your printcap entry to a new entry, called for example: "lntek"
  78. ;    Be sure that the pl and pw parameters are not set.  Also,
  79. ;    disable all output filters.  Use xc#0177777:xs#040 to disable
  80. ;    output translations.  Then to print a plot file, enter: 
  81. ;        lpr -Plntek file.
  82. ;
  83. ; PROCEDURE:
  84. ;    Opening Call:    Open the file, set the device to that of a TEK 4014 
  85. ;            printer, output the correct escape sequence.
  86. ;
  87. ;    Closing Call:    Restore the previous graphics device and send out the 
  88. ;            correct closing escape sequence before closing the 
  89. ;            file.
  90. ;
  91. ; MODIFICATION HISTORY:
  92. ;    DMS, March, 1988.
  93. ;    SMR, September, 1990.    Updated to work with V2 of IDL and included all
  94. ;                       pertinent documentation in library header.
  95. ;-
  96.  
  97. common ln03_common, unit, restoredevice
  98.  
  99. if n_elements(unit) eq 0 then unit = 0    ;First time?
  100. esc = string(27b)        ;Escape character
  101. empty                ;Empty graphics buffer.
  102. n = n_params(0)            ;# of params
  103. if n lt 2 then to_terminal = 1    ;Default = to terminal also
  104.  
  105. if n eq 0 then begin        ;Close the file?
  106.     if unit eq 0 then print,'LN03 - File not open for plots.' $
  107.     else begin
  108. ;;;;        erase        ;output the page
  109.         printf,unit, esc+'[!p'    ;Escape seq for out of tek mode
  110.         device, /close    ;Close file
  111.         unit = 0    ;Show closed.
  112.         set_plot, restoredevice
  113.     endelse
  114. endif else begin        ;Opening file:
  115.     if unit ne 0 then print,'LN03 - File already open for plots.' $
  116.     else begin        ;Open it...
  117.         get_lun, unit    ;Get a lun
  118.         openw,unit,filename, error = err, $
  119.               /none             ;Open output, no carr cont
  120.         if(err eq 0) then begin 
  121.             restoredevice = !D.name
  122.             set_plot, 'tek'
  123.             device, TEK4014 = 1    ;use the maximum resolution
  124.             printf, unit, esc + '[?38h' ;Into tek mode esc seq
  125.             if (to_terminal eq 0) then device, plot_to = unit $
  126.             else device, plot_to = -unit
  127.         endif else begin
  128.             unit = 0
  129.             message, "Ln03 output file name should be a string"
  130.         endelse
  131.     endelse
  132. endelse
  133.  
  134. end
  135.  
  136.